<?php
	$tblCategory = new Zendvn_Models_Category();
	$tblMenu = $tblCategory->listItem($view->arrParam,array('task' => 'block-category'));
?>
<?php
		if(!empty($tblMenu)){
			foreach ($tblMenu as $key => $value) {		
			$name 	= $value['name'];
			$link 	= $view->baseUrl('/products/index/category/cid/' 
												 . $value['id'] . '/name/' 
												 . $value['alias']);
			$id = $value['id'];
			if($key%2 == 0){
				$clsBg = 'bag-title-right-blue';
				$itemClass = 'item-link';
			}else{
				$clsBg = 'bag-title-right-green';
				$itemClass = 'item-link2';
			}
?>                

                <div class="box-right mar-top-20">                	
                    <div class="sub-right <?php echo $clsBg ?>"><a href="<?php echo $link?>"><?php echo $name ?></a></div>
                    <div class="cnt-box-right">
                        <ul class="nav-cat">
                        	<?php  
                        	$items = $tblCategory->listItem($view->arrParam,array('parents'=>$id,'task'=>'block-child'));
                        	if(!empty($items)){                        		
	                        	foreach ($items as $keyw => $item){
	                        	$id = $item['id'];
	                        	$name = $item['name'];
	                        	$cls = 'item' . $keyw;
                        	?>
                            <li class="item">
                                <a class="<?php echo $itemClass ?> i-link active" href="#"><?php echo $name ?></a>
                                <ul class="<?php echo $cls?>">
                                	<?php  
		                        	$items = $tblCategory->listItem($view->arrParam,array('parents'=>$id,'task'=>'block-child'));
		                        	if(!empty($items)){
		                        	foreach ($items as $item){
		                        		$name = $item['name'];
			                        	$lang = $view->arrParam['lang'];
						                if(empty($lang)){
						                    $lang = 'vi';
						                }else{
						                    $lang = $view->arrParam['lang'];
						                }
						                $page = 1;
										$urlOptions = array('module'=>'tour','controller'=>'index',
																	'action'=>'category',
				                    								'cid'=> $item['id'],
																	'name'=>$item['alias'],
				                    								'lang'=>$lang,
				                    								'page'=>$page);
				                    	$linkDetail = $view->url($urlOptions,'tour-category');
				                    	$id = 'item-' . $item[id];
		                        	?>                                  
                                    <li title="<?php echo $itemClass?>" id='<?php echo $id ?>'><a  href="<?php echo $linkDetail;?>"><?php echo $name ?></a></li>   
                                    <?php } }?>                     
                                </ul>
                            </li>
                            <?php }} ?>
                        </ul>
                    </div>
                </div>
  <?php } } 
  ?>
  <script>
  	$(document) .ready(function(){
  		var item = '<?php echo "item-" . $view->arrParam["cid"] ?>';
  	  	var title = $('#' + item).attr('title');
  	  	$('.'+title).next().slideUp();
  	  	$('#' + item + ' a').addClass('active-item');
    	$('#' + item).parent().slideDown();
  	})
  </script>
  
  
  
  
                